<?php
/**
 * Description of this file
 *
 * @author  peng49 <a1215517@sohu.com>
 * @date    2020/8/19 13:02
 */

session_start();

if (isset($_SESSION['username'])) {
    echo "登录用户{$_SESSION['username']}";
} else {
    if (isset($_GET['token'])) {
        //token
        $token = $_GET['token'];

        //todo 校验token 是否有效

        //有效之后保存用户信息

        $_SESSION['username'] = $token;


        echo "登录成功,用户:{$token}";
    } else {
        //未登录转跳的sso登录
        header("Location:http://sso.me/login_form.php?redirect=http://app01.me");
    }
}
